home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase Pro v7.0 / DATA1.CAB / Utilities / Upgrade / Rpttorep.wfm < prev    next >
Encoding:
Text File  |  1997-11-20  |  23.5 KB  |  922 lines

  1. // Protects against direct calls to .WFM by user
  2. // Test for "test.wiz" is to allow developers to bypass this protection
  3.  
  4. If not file('Test.wiz')
  5.    msgbox('Run RptToRep.Prg','Wrong File',16)
  6.    return
  7. Endif
  8.  
  9. /* This code is used only for testing in design phase. 
  10.    It instantiates inernationalization class
  11.  
  12. */
  13. f = new RptToRepForm()
  14. f.oLang = New InternationalText(f)
  15. f.oLang.SetUpStrings()
  16. f.MDI = .f.
  17. f.ReadModal()
  18. ** END HEADER -- do not remove this line
  19. //
  20. // Generated on 11/15/97
  21. //
  22. parameter bModal
  23. local f
  24. f = new RptToRepForm()
  25. if (bModal)
  26.    f.mdi = false // ensure not MDI
  27.    f.readModal()
  28. else
  29.    f.open()
  30. endif
  31.  
  32. class RptToRepForm of FORM
  33.    with (this)
  34.       canClose = class::FORM_CANCLOSE
  35.       onOpen = class::FORM_ONOPEN
  36.       scaleFontSize = 8
  37.       scaleFontBold = false
  38.       metric = 6    // Pixels
  39.       height = 275
  40.       left = 154
  41.       top = 39
  42.       width = 444
  43.       text = "Report Conversion Wizard - Step 1 of 4"
  44.       autoCenter = true
  45.       mdi = false
  46.       moveable = false
  47.       escExit = false
  48.       maximize = false
  49.       minimize = false
  50.    endwith
  51.  
  52.  
  53.    this.LINE1 = new LINE(this)
  54.    with (this.LINE1)
  55.       left = 22
  56.       right = 421
  57.       top = 228
  58.       bottom = 229
  59.       width = 2
  60.       metric = 6    // Pixels
  61.       colorNormal = "N+"
  62.       pageno = 0
  63.    endwith
  64.  
  65.  
  66.    this.LINE2 = new LINE(this)
  67.    with (this.LINE2)
  68.       left = 21
  69.       right = 422
  70.       top = 227
  71.       bottom = 228
  72.       width = 2
  73.       metric = 6    // Pixels
  74.       colorNormal = "W+"
  75.       pageno = 0
  76.    endwith
  77.  
  78.  
  79.    this.INTROTEXT = new TEXT(this)
  80.    with (this.INTROTEXT)
  81.       height = 45
  82.       left = 139
  83.       top = 23
  84.       width = 280
  85.       metric = 6    // Pixels
  86.       colorNormal = "BtnText"
  87.       fontSize = 8
  88.       text = "<p>This Wizard will convert reports and labels written in Crystal 3.0 (.rpt,.rpl) to Visual dBASE 7 Report Classes (.rep, .lab).</p>"
  89.    endwith
  90.  
  91.  
  92.    this.BACKBUTTON = new PUSHBUTTON(this)
  93.    with (this.BACKBUTTON)
  94.       onClick = class::BACKBUTTON_ONCLICK
  95.       enabled = false
  96.       height = 20
  97.       left = 114
  98.       top = 241
  99.       width = 72
  100.       text = "Back"
  101.       metric = 6    // Pixels
  102.       fontSize = 8
  103.       group = true
  104.       colorNormal = "BtnText/BtnFace"
  105.       pageno = 0
  106.       value = false
  107.    endwith
  108.  
  109.  
  110.    this.NEXTBUTTON = new PUSHBUTTON(this)
  111.    with (this.NEXTBUTTON)
  112.       onClick = class::NEXTBUTTON_ONCLICK
  113.       height = 20
  114.       left = 186
  115.       top = 241
  116.       width = 72
  117.       text = "Next"
  118.       metric = 6    // Pixels
  119.       fontSize = 8
  120.       group = true
  121.       colorNormal = "BtnText/BtnFace"
  122.       pageno = 0
  123.       value = false
  124.    endwith
  125.  
  126.  
  127.    this.CANCELBUTTON = new PUSHBUTTON(this)
  128.    with (this.CANCELBUTTON)
  129.       onClick = class::CANCELBUTTON_ONCLICK
  130.       height = 20
  131.       left = 268
  132.       top = 241
  133.       width = 72
  134.       text = "Cancel"
  135.       metric = 6    // Pixels
  136.       fontSize = 8
  137.       group = true
  138.       colorNormal = "BtnText/BtnFace"
  139.       pageno = 0
  140.       value = false
  141.    endwith
  142.  
  143.  
  144.    this.HELPBUTTON = new PUSHBUTTON(this)
  145.    with (this.HELPBUTTON)
  146.       onClick = class::HELPBUTTON_ONCLICK
  147.       height = 20
  148.       left = 350
  149.       top = 241
  150.       width = 72
  151.       text = "Help"
  152.       metric = 6    // Pixels
  153.       fontSize = 8
  154.       group = true
  155.       colorNormal = "BtnText/BtnFace"
  156.       pageno = 0
  157.       value = false
  158.    endwith
  159.  
  160.  
  161.    this.IMAGE1 = new IMAGE(this)
  162.    with (this.IMAGE1)
  163.       height = 13
  164.       left = 114
  165.       top = 25
  166.       width = 13
  167.       metric = 6    // Pixels
  168.       dataSource = "FILENAME Arrow.bmp"
  169.       alignment = 4    // True Size
  170.       borderStyle = 3    // None
  171.    endwith
  172.  
  173.  
  174.    this.DISCLAIMERTEXT = new TEXT(this)
  175.    with (this.DISCLAIMERTEXT)
  176.       height = 96
  177.       left = 138
  178.       top = 75
  179.       width = 280
  180.       metric = 6    // Pixels
  181.       colorNormal = "BtnText"
  182.       fontSize = 8
  183.       text = "Some commands and functions supported in Visual dBASE QBE queries do not translate directly into Visual dBASE 7 Data Classes. If this Wizard encounters any such problems, it will present a list on the last page. The same list will be embedded above the hea"
  184.       text += "der in the generated .rep or .lab file. You may have to adjust the generated file to match your original QBE."
  185.    endwith
  186.  
  187.  
  188.    this.IMAGE2 = new IMAGE(this)
  189.    with (this.IMAGE2)
  190.       height = 13
  191.       left = 114
  192.       top = 77
  193.       width = 13
  194.       metric = 6    // Pixels
  195.       dataSource = "FILENAME Arrow.bmp"
  196.       alignment = 4    // True Size
  197.       borderStyle = 3    // None
  198.    endwith
  199.  
  200.  
  201.    this.IMAGE3 = new IMAGE(this)
  202.    with (this.IMAGE3)
  203.       height = 100
  204.       left = 12
  205.       top = 15
  206.       width = 75
  207.       metric = 6    // Pixels
  208.       dataSource = "FILENAME Rpttorep.bmp"
  209.       alignment = 4    // True Size
  210.       pageno = 0
  211.       borderStyle = 3    // None
  212.    endwith
  213.  
  214.  
  215.    this.ENTERPATHTEXT = new TEXT(this)
  216.    with (this.ENTERPATHTEXT)
  217.       height = 42
  218.       left = 137
  219.       top = 27
  220.       width = 283
  221.       metric = 6    // Pixels
  222.       colorNormal = "BtnText"
  223.       fontSize = 8
  224.       text = "<p>Enter the path to the Crystal source file to be converted.</p><p></p>"
  225.       pageno = 2
  226.    endwith
  227.  
  228.  
  229.    this.IMAGE4 = new IMAGE(this)
  230.    with (this.IMAGE4)
  231.       height = 13
  232.       left = 124
  233.       top = 28
  234.       width = 13
  235.       metric = 6    // Pixels
  236.       dataSource = "FILENAME Arrow.bmp"
  237.       alignment = 4    // True Size
  238.       pageno = 2
  239.       borderStyle = 3    // None
  240.    endwith
  241.  
  242.  
  243.    this.SOURCEPATHFIELD = new ENTRYFIELD(this)
  244.    with (this.SOURCEPATHFIELD)
  245.       onLostFocus = class::SOURCEPATHFIELD_ONLOSTFOCUS
  246.       onChange = class::SOURCEPATHFIELD_ONCHANGE
  247.       height = 20
  248.       left = 132
  249.       top = 76
  250.       width = 254
  251.       metric = 6    // Pixels
  252.       colorHighLight = ""
  253.       fontSize = 8
  254.       value = ""
  255.       maxLength = 255
  256.       pageno = 2
  257.       borderStyle = 7    // Client
  258.    endwith
  259.  
  260.  
  261.    this.TARGETPATHFIELD = new ENTRYFIELD(this)
  262.    with (this.TARGETPATHFIELD)
  263.       onLostFocus = class::TARGETPATHFIELD_ONLOSTFOCUS
  264.       onChange = class::TARGETPATHFIELD_ONCHANGE
  265.       height = 20
  266.       left = 133
  267.       top = 182
  268.       width = 254
  269.       metric = 6    // Pixels
  270.       colorHighLight = ""
  271.       fontSize = 8
  272.       value = ""
  273.       maxLength = 255
  274.       pageno = 2
  275.       borderStyle = 7    // Client
  276.    endwith
  277.  
  278.  
  279.    this.GETSOURCEFILEBUTTON = new PUSHBUTTON(this)
  280.    with (this.GETSOURCEFILEBUTTON)
  281.       onClick = class::GETSOURCEFILEBUTTON_ONCLICK
  282.       height = 20
  283.       left = 393
  284.       top = 76
  285.       width = 32
  286.       text = ""
  287.       metric = 6    // Pixels
  288.       upBitmap = "RESOURCE #148"
  289.       fontSize = 8
  290.       group = true
  291.       colorNormal = "BtnText/BtnFace"
  292.       pageno = 2
  293.       value = false
  294.    endwith
  295.  
  296.  
  297.    this.GETTARGETFILEBUTTON = new PUSHBUTTON(this)
  298.    with (this.GETTARGETFILEBUTTON)
  299.       onClick = class::GETTARGETFILEBUTTON_ONCLICK
  300.       height = 20
  301.       left = 394
  302.       top = 182
  303.       width = 32
  304.       text = ""
  305.       metric = 6    // Pixels
  306.       upBitmap = "RESOURCE #148"
  307.       fontSize = 8
  308.       group = true
  309.       colorNormal = "BtnText/BtnFace"
  310.       pageno = 2
  311.       value = false
  312.    endwith
  313.  
  314.  
  315.    this.SOURCEFILETEXT = new TEXT(this)
  316.    with (this.SOURCEFILETEXT)
  317.       height = 15
  318.       left = 137
  319.       top = 60
  320.       width = 183
  321.       metric = 6    // Pixels
  322.       colorNormal = "BtnText"
  323.       fontSize = 8
  324.       text = "Source Crystal Report or Label File"
  325.       pageno = 2
  326.    endwith
  327.  
  328.  
  329.    this.TARGETFILETEXT = new TEXT(this)
  330.    with (this.TARGETFILETEXT)
  331.       height = 17
  332.       left = 133
  333.       top = 163
  334.       width = 254
  335.       metric = 6    // Pixels
  336.       colorNormal = "BtnText"
  337.       fontSize = 8
  338.       text = "Target Visual dBASE 7 Report or Label File"
  339.       pageno = 2
  340.    endwith
  341.  
  342.  
  343.    this.REPORTRADIO = new RADIOBUTTON(this)
  344.    with (this.REPORTRADIO)
  345.       height = 20
  346.       left = 226
  347.       top = 185
  348.       width = 60
  349.       text = "Report"
  350.       metric = 6    // Pixels
  351.       colorNormal = "WindowText/BtnFace"
  352.       fontSize = 8
  353.       group = true
  354.       value = true
  355.    endwith
  356.  
  357.  
  358.    this.LABELRADIO = new RADIOBUTTON(this)
  359.    with (this.LABELRADIO)
  360.       height = 20
  361.       left = 295
  362.       top = 185
  363.       width = 50
  364.       text = "Label"
  365.       metric = 6    // Pixels
  366.       colorNormal = "WindowText/BtnFace"
  367.       fontSize = 8
  368.       group = false
  369.       value = false
  370.    endwith
  371.  
  372.  
  373.    this.SELECTTYPETEXT = new TEXT(this)
  374.    with (this.SELECTTYPETEXT)
  375.       height = 14
  376.       left = 138
  377.       top = 187
  378.       width = 72
  379.       metric = 6    // Pixels
  380.       colorNormal = "BtnText"
  381.       fontSize = 8
  382.       text = "Select Type"
  383.    endwith
  384.  
  385.  
  386.    this.PROBLEMTEXT = new TEXT(this)
  387.    with (this.PROBLEMTEXT)
  388.       height = 27
  389.       left = 148
  390.       top = 26
  391.       width = 280
  392.       metric = 6    // Pixels
  393.       colorNormal = "BtnText"
  394.       fontSize = 8
  395.       text = "The Report Conversion Wizard encountered the following problems converting your report or label:"
  396.       pageno = 4
  397.    endwith
  398.  
  399.  
  400.    this.IMAGE5 = new IMAGE(this)
  401.    with (this.IMAGE5)
  402.       height = 13
  403.       left = 124
  404.       top = 28
  405.       width = 13
  406.       metric = 6    // Pixels
  407.       dataSource = "FILENAME Arrow.bmp"
  408.       alignment = 4    // True Size
  409.       pageno = 4
  410.       borderStyle = 3    // None
  411.    endwith
  412.  
  413.  
  414.    this.DISPLAYSOURCEFIELD = new ENTRYFIELD(this)
  415.    with (this.DISPLAYSOURCEFIELD)
  416.       when = {;return false}
  417.       height = 20
  418.       left = 139
  419.       top = 82
  420.       width = 273
  421.       metric = 6    // Pixels
  422.       colorNormal = "N+/W"
  423.       colorHighLight = ""
  424.       fontSize = 8
  425.       fontBold = true
  426.       value = ""
  427.       pageno = 3
  428.       borderStyle = 3    // None
  429.    endwith
  430.  
  431.  
  432.    this.DISPLAYTARGETFIELD = new ENTRYFIELD(this)
  433.    with (this.DISPLAYTARGETFIELD)
  434.       when = {;return false}
  435.       height = 20
  436.       left = 139
  437.       top = 127
  438.       width = 274
  439.       metric = 6    // Pixels
  440.       colorNormal = "N+/W"
  441.       colorHighLight = ""
  442.       fontSize = 8
  443.       fontBold = true
  444.       value = ""
  445.       pageno = 3
  446.       borderStyle = 3    // None
  447.    endwith
  448.  
  449.  
  450.    this.SOURCEFILEDISPLAYTEXT = new TEXT(this)
  451.    with (this.SOURCEFILEDISPLAYTEXT)
  452.       height = 14
  453.       left = 139
  454.       top = 64
  455.       width = 254
  456.       metric = 6    // Pixels
  457.       colorNormal = "BtnText"
  458.       fontSize = 8
  459.       text = "Source Crystal Report or Label File:"
  460.       pageno = 3
  461.    endwith
  462.  
  463.  
  464.    this.TARGETFILEDISPLAYTEXT = new TEXT(this)
  465.    with (this.TARGETFILEDISPLAYTEXT)
  466.       height = 14
  467.       left = 139
  468.       top = 109
  469.       width = 254
  470.       metric = 6    // Pixels
  471.       colorNormal = "BtnText"
  472.       fontSize = 8
  473.       text = "Target Visual dBASE 7 Report or Label File:"
  474.       pageno = 3
  475.    endwith
  476.  
  477.  
  478.    this.CONVERTPROGRESS = new PROGRESS(this)
  479.    with (this.CONVERTPROGRESS)
  480.       height = 20
  481.       left = 139
  482.       top = 177
  483.       width = 270
  484.       metric = 6    // Pixels
  485.       pageno = 3
  486.       value = 0
  487.       rangeMin = 0
  488.       rangeMax = 100
  489.    endwith
  490.  
  491.  
  492.    this.FINISHTEXT = new TEXT(this)
  493.    with (this.FINISHTEXT)
  494.       height = 36
  495.       left = 139
  496.       top = 28
  497.       width = 216
  498.       metric = 6    // Pixels
  499.       colorNormal = "BtnText"
  500.       fontSize = 8
  501.       text = "<p>Click Finish to convert your Crystal file...</p>"
  502.       pageno = 3
  503.    endwith
  504.  
  505.  
  506.    this.IMAGE6 = new IMAGE(this)
  507.    with (this.IMAGE6)
  508.       height = 13
  509.       left = 124
  510.       top = 28
  511.       width = 13
  512.       metric = 6    // Pixels
  513.       dataSource = "FILENAME Arrow.bmp"
  514.       alignment = 4    // True Size
  515.       pageno = 3
  516.       borderStyle = 3    // None
  517.    endwith
  518.  
  519.  
  520.    this.PROGRESSLABEL = new TEXT(this)
  521.    with (this.PROGRESSLABEL)
  522.       height = 16
  523.       left = 139
  524.       top = 159
  525.       width = 173
  526.       metric = 6    // Pixels
  527.       colorNormal = "BtnText"
  528.       fontSize = 8
  529.       text = "Progress"
  530.       pageno = 3
  531.    endwith
  532.  
  533.  
  534.    this.PROBLEMLISTBOX = new LISTBOX(this)
  535.    with (this.PROBLEMLISTBOX)
  536.       height = 135
  537.       left = 123
  538.       top = 72
  539.       width = 300
  540.       metric = 6    // Pixels
  541.       id = 133
  542.       fontSize = 8
  543.       colorHighLight = "HighLightText/HighLight"
  544.       pageno = 4
  545.    endwith
  546.  
  547.  
  548.    this.TARGETPATHLABEL = new TEXT(this)
  549.    with (this.TARGETPATHLABEL)
  550.       height = 42
  551.       left = 137
  552.       top = 120
  553.       width = 266
  554.       metric = 6    // Pixels
  555.       colorNormal = "BtnText"
  556.       fontSize = 8
  557.       text = "<p>Enter the path to the Report or Label file this Wizard will generate.</p><p></p>"
  558.       pageno = 2
  559.    endwith
  560.  
  561.  
  562.    this.IMAGE7 = new IMAGE(this)
  563.    with (this.IMAGE7)
  564.       height = 13
  565.       left = 124
  566.       top = 121
  567.       width = 13
  568.       metric = 6    // Pixels
  569.       dataSource = "FILENAME Arrow.bmp"
  570.       alignment = 4    // True Size
  571.       pageno = 2
  572.       borderStyle = 3    // None
  573.    endwith
  574.  
  575.  
  576.    ///////////////Method::PageChange///////////////////////
  577.    /* Params   -  None
  578.  
  579.  
  580.  
  581.    */
  582.    function PageChange
  583.    if form.pageno = 1
  584.       form.BackButton.enabled   := false
  585.       form.NextButton.text      := form.oLang.iText('Next')
  586.       form.NextButton.enabled   := true
  587.       form.text = form.oLang.iText('Page1Title')
  588.  
  589.    elseif form.pageno = 2
  590.       form.BackButton.enabled   := true
  591.       form.NextButton.text      := form.oLang.iText('Next')
  592.       form.NextButton.enabled   := class::AreFilePathsOK()
  593.       form.text                 := form.oLang.iText('Page2Title')
  594.       class::AreFilePathsOk()  // check Next button status
  595.                             // for page 3
  596.    elseif form.pageno = 3
  597.       form.DisplaySourceField.value := ;
  598.            form.SourcePathField.value
  599.       form.DisplayTargetField.value := ;
  600.            form.TargetPathField.value
  601.       form.ProgressLabel.text   := form.oLang.iText('Progress')
  602.       form.BackButton.enabled   := true
  603.       form.NextButton.text      := form.oLang.iText('Finish')
  604.       form.CancelButton.enabled := true
  605.       form.text                 := form.oLang.iText('Page3Title')
  606.  
  607.    elseif form.pageno = 4
  608.       form.NextButton.text      := form.oLang.iText('Close')
  609.       form.CancelButton.enabled := false
  610.       form.text                 := form.oLang.iText('Page4Title')
  611.  
  612.    endif
  613.  
  614.    
  615.  
  616.    ///////////////Method::AreFilePathsOK/////////////////////////
  617.    /* Params    -    None
  618.       Purpose   -    Determines that source and target fields have
  619.                      data in them. Does no validation, That is done
  620.                      in the OnChange events of the respective 
  621.                      entryfields
  622.       Called by -    Method:PageChange and OnChange of source and
  623.                      target entryfields. Also onLostFocus of entryfields 
  624.    
  625.    */
  626.         
  627.  
  628.    function AreFilePathsOk
  629.   
  630.       if form.pageno # 2  // only used on page 2
  631.          return
  632.       endif
  633.  
  634.       local bFilePathsAreOk   // set var for nextbutton
  635.       bFilePathsAreOk = false    // enabled status
  636.  
  637.  
  638.       local cExtension    // set var for proper extension
  639.                               // for report or label
  640.       cExtension = iif(form.ReportRadio.value,'.RPT','.RPL')
  641.  
  642.  
  643.       local cTargetExtension  // set var for proper
  644.                               // extension for dest file
  645.       cTargetExtension = iif(form.ReportRadio.value,;
  646.                         '.REP','.LAB')
  647.  
  648.  
  649.          //if either field is empty, forget it
  650.       if empty(form.SourcePathField.value) or  ;
  651.           empty(form.TargetPathField.value)
  652.  
  653.          // if you can't find source file, forget it
  654.       elseif not file(form.sourcePathField.value)
  655.  
  656.          // if source file is not the right extension
  657.       elseif at(cExtension,upper(form.SourcePathField.value))  = 0
  658.  
  659.          // if Target file is not the right extension
  660.       elseif at(cTargetExtension,;
  661.                    upper(form.TargetPathField.value)) = 0
  662.  
  663.          // otherwise, everything looks OK
  664.       else
  665.  
  666.          bFilePathsAreOk := true
  667.  
  668.       endif
  669.  
  670.          // turn on button if paths are valid
  671.       form.NextButton.enabled := bFilePathsAreOk 
  672.  
  673.       return bFilePathsAreOk
  674.  
  675.  
  676.    ///////////////Method:SourcePathField.onChange//////////////
  677.    /* Params   -  None
  678.       Purpose  -  Determines if a valid file type has been typed in
  679.                   or selected from GetFile()
  680.       Fired by -  form.SourceField
  681.  
  682.    */
  683.  
  684.    // {Linked Method} form.onChange
  685.    function SOURCEPATHFIELD_onChange
  686.       
  687.           // declare vars for use in method
  688.       local cPath,bSourceIsOk,cExtension
  689.       cPath       = upper(form.SourcePathField.value)
  690.       cExtension  = iif(form.ReportRadio.value,'.RPT','.RPL')
  691.       cTargetExtension = iif(form.ReportRadio.value,'.REP','.LAB')
  692.  
  693.       bSourceIsOk = true   //assume path is OK
  694.  
  695.       if len(trim(cPath)) = 0 // if field emptied
  696.          // do no more tests
  697.          bSourceIsOk = false
  698.          // if report selected, and not an .rpt file
  699.  
  700.       elseif form.ReportRadio.value and at('.RPT',cPath) = 0
  701.          msgbox('Not a Crystal .RPT file!','Wrong File Type',16)
  702.          bSourceIsOk = false
  703.  
  704.          // if label selected, and not an .rpl file
  705.       elseif form.LabelRadio.value and at('.RPL',cPath) = 0
  706.          msgbox('Not a Crystal .RPL file!','Wrong File Type',16)
  707.          bSourceIsOk = false
  708.  
  709.          // test if file exists
  710.       elseif not file(cPath)
  711.          msgbox('   File not found "'+trim(form.SourcePathField.value)+'"   ',;
  712.                 'File Missing',16)
  713.          bSourceIsOk = false
  714.       endif
  715.  
  716.          // try to default Target file name
  717.       if bSourceIsOk and empty(form.TargetPathField.value)
  718.          if at(cExtension,cPath) > 0   // if source extension found
  719.                                        // strip it off and add Target
  720.                                        // extension
  721.             form.TargetPathField.value =;
  722.                  substr(cPath,1,at(cExtension,cPath)-1)+cTargetExtension
  723.             form.TargetIsFromDefault = .t.  // toggle to ensure overwrite
  724.                                              // validation later
  725.          endif
  726.       endif
  727.  
  728.       class::AreFilePathsOk() // check paths, reset Next button
  729.  
  730.  
  731.       return true
  732.  
  733.    // {Linked Method} form.onLostFocus
  734.    function SOURCEPATHFIELD_onLostFocus
  735.  
  736.       class::AreFilePathsOk()
  737.          
  738.       return true
  739.       
  740.    ///////////////Method:TargetPathField.onChange/////////////
  741.    /* Params   -  None
  742.       Purpose  -  Determines if a valid file type has been typed in
  743.                   or selected from GetFile()
  744.       Fired by -  form.SourceField
  745.  
  746.    
  747.  
  748.    */
  749.  
  750.    // {Linked Method} form.onChange
  751.    function TargetPATHFIELD_onChange
  752.    
  753.       local cPath
  754.       cPath       = upper(Form.TargetPathField.value)
  755.  
  756.       if empty(cPath) // if field emptied
  757.          // do no more tests
  758.  
  759.          // if report selected, and not an .rep file
  760.       elseif form.ReportRadio.value and at('.REP',cPath) = 0
  761.          msgbox(form.oLang.iText('NOTADBASEREPORT'),;
  762.                 form.oLang.iText('WRONGFILETYPE'),16)
  763.    
  764.          // if label selected, and not an .rpl file
  765.       elseif form.LabelRadio.value and at('.LAB',upper(cPath)) = 0
  766.          msgbox(form.oLang.iText('NOTADBASELABEL'),;
  767.                 form.oLang.iText('WRONGFILETYPE'),16)
  768.  
  769.          // test if file exists
  770.       elseif file(cPath) and not form.IsComingFromPutFile
  771.          if msgbox(form.oLang.iText('FILEALREADYEXISTS',cPath),;
  772.                    form.oLang.iText('OVERWRITE'),36) # 6
  773.             form.TargetPathField.value = ''
  774.          endif
  775.       endif
  776.  
  777.       form.TargetIsFromDefault = false // no longer need to test default
  778.       class::AreFilePathsOk()  // update status of Next button
  779.  
  780.       return true  // it is a valid Crystal source file
  781.       
  782.  
  783.    // {Linked Method} form.onLostFocus
  784.    function TargetPATHFIELD_onLostFocus
  785.  
  786.       class::AreFilePathsOk()
  787.  
  788.       return true
  789.  
  790.    // {Linked Method} form.onOpen
  791.    function form_onOpen
  792.       this.IsComingFromPutFile = false
  793.       this.TargetIsFromDefault = false
  794.       return
  795.  
  796.    // {Linked Method} form.onClick
  797.    function GETTargetFILEBUTTON_onClick
  798.  
  799.       Local cDestPath    // get path for VdB 7 Report file
  800.  
  801.  
  802.       cDestPath = PutFile('Target Filename','',;
  803.                   iif(form.ReportRadio.value,'*.rep','*.lab'))
  804.  
  805.       if empty(cDestPath)   // if cancelled, forget it
  806.          return  false
  807.       endif
  808.  
  809.          //Update value and validate
  810.       form.TargetPathField.Value := cDestPath
  811.  
  812.       form.IsComingFromPutFile := true  //removes duplicate "already exists?'
  813.       class::TargetPathField_OnChange()
  814.       form.IsComingFromPutFile := false
  815.  
  816.       return true
  817.  
  818.    // {Linked Method} form.onClick
  819.    function HELPBUTTON_onClick
  820.       Help
  821.       return
  822.  
  823.    // {Linked Method} form.onClick
  824.    function GETSOURCEFILEBUTTON_onClick
  825.  
  826.       local cSource    // get path for Crystal Source file
  827.       cSource = getfile(iif(form.ReportRadio.value,'*.rpt','*.rpl'))
  828.  
  829.       if empty(cSource)  // if cancelled, forget it
  830.          return false
  831.       endif
  832.  
  833.          //Update value and validate
  834.       form.SourcePathField.value := cSource
  835.       class::SourcePathField_OnChange()
  836.  
  837.       return true
  838.  
  839.    // {Linked Method} form.onClick
  840.    function BACKBUTTON_onClick
  841.       -- form.pageno
  842.       class::PageChange()
  843.       return
  844.  
  845.    // {Linked Method} form.onClick
  846.    function CANCELBUTTON_onClick
  847.       form.close()
  848.       return false
  849.  
  850.    // {Linked Method} form.canClose
  851.    function form_canClose
  852.       form.env.reset()  // reset environment
  853.       set help to
  854.       return true
  855.  
  856.    // {Linked Method} form.onClick
  857.    function NEXTBUTTON_onClick
  858.      
  859.       if form.pageno = 2 .and. form.TargetIsFromDefault
  860.  
  861.             // test defaulted target file to see if 
  862.             // the Wizard may overwrite...
  863.  
  864.          if file(form.TargetPathField.value)
  865.             if msgbox(form.oLang.iText('FILEALREADYEXISTS',;
  866.                       form.TargetPathField.value),;
  867.                       form.oLang.iText('OVERWRITE'),36)# 6
  868.                return
  869.             endif
  870.           endif
  871.  
  872.       elseif form.pageno = 4  // if last page, get off
  873.          form.close()
  874.  
  875.       elseif form.pageno = 3 // if finish page, process
  876.  
  877.          if type('form.oRep') # 'O'
  878.             set proc to RptToRepConv.cc addi  // load in processing class            
  879.          endif
  880.  
  881.          form.oRep                = New ReportConverter(form)
  882.          form.oRep.InFilename    := form.SourcePathField.value
  883.          form.oRep.OutFilename   := form.TargetPathField.value
  884.          form.oRep.ProgressObject = form.ConvertProgress
  885.          form.oRep.ShowProgress = True
  886.  
  887.  
  888.     
  889.  
  890.             // read in Crystal file
  891.             //** visible only here for beta bug - text does not show
  892.             form.progresslabel.visible = false
  893.             form.ProgressLabel.text = form.oLang.iText('READINGINCRYSTAL')
  894.             form.progresslabel.visible = true
  895.  
  896.          if not form.oRep.BuildReport()
  897.  
  898.             close proc RptToRepConv.cc
  899.             form.ProgressLabel.text = ''
  900.             form.refresh()
  901.             return
  902.  
  903.          else
  904.  
  905.             form.progresslabel.visible = false
  906.             form.ProgressLabel.text = form.oLang.iText('STREAMINGVDB')
  907.             form.ProgressLabel.visible = true
  908.             form.oRep.StreamReport()
  909.  
  910.          endif
  911.  
  912.          form.ProgressLabel.text = form.oLang.iText('DONE')
  913.          form.ConvertProgress.position = 0
  914.          form.ProblemListBox.DataSource = "ARRAY form.oRep.aErrors"
  915.  
  916.       endif
  917.  
  918.       ++ form.pageno       // increment page
  919.       class::PageChange()      
  920.       return true
  921. endclass
  922.